1. Field of the Invention
The present invention is related to memory management, and more specifically, to a method and apparatus for data swap in virtual machine environment.
2. Description of the Related Art
A virtual machine is a software-implemented machine that can execute various applications like a physical machine. A virtual machine runs on a host, and a virtual address of the virtual machine is mapped to a physical address of the host so as to enable the access to physical memory of the host.
Data swap technology is commonly used in memory management. For example, in a memory management system of a computer, when memory resources are in shortage, data with relatively low utilization can be swapped to other storage devices (e.g., a hard disk, a Flash memory, etc.) so as to release memory resources. The swapped data can be temporarily saved in other storage devices and accessed where necessary.
Various technical solutions for swapping data have been developed so far. However, various problems can arise when applying existing technical solutions to a virtual machine environment. Although a virtual machine is logically manifested as an independent computer, it can be distributed on a plurality of physical machines physically. Thus in a virtual machine environment, when data in a memory is swapped to another storage device, since this storage device can be a remote device, additional overheads can arise during data swapping. In addition, even a host where a virtual machine is located has free memory/storage resources locally, the virtual machine is not entitled to utilize these free memory/storage resources, but can only utilize the resources that are allocated in advance.
With the wide adoption of virtual machine technology, providers of virtual machines pay more and more attention to the operation efficiency of virtual machines. Therefore, how to improve the data swap efficiency in a virtual machine environment has become a key problem.